//
//  YATaskCheckVersion.m
//  YoucApi
//
//  Created by 21CN Vgo on 12/11/12.
//
//

#import "YATaskCheckVersion.h"
#import "YARespAppVersion.h"

@implementation YATaskCheckVersion

TASK_AUTO_REGISTER(TaskCheckVersion);

- (NSString *)_getUriParamC
{
	return @"version";
}

- (NSString *)_getUriParamA
{
	return @"check_version";
}

- (BOOL)_checkValidResponse:(id)responseObject
{
	return [responseObject isKindOfClass:[NSDictionary class]];
}

- (void)_dealWithJSONResponse:(id)responseObject withError:(NSError *)error
{
	YARespAppVersion *respAppVersion = [[[YARespAppVersion alloc] initWithError:error context:self.context] autorelease];
	
	respAppVersion.version = [self.params objectForKey:KEY_APPVERSION];
	respAppVersion.description = [self.params objectForKey:KEY_APPDESCRIPTION];
	respAppVersion.appUrl = [self.params objectForKey:KEY_APPURL];
    
	if ([self.delegate respondsToSelector:@selector(checkVersionResponse:respAppVersion:)])
	{
		[self.delegate checkVersionResponse:self respAppVersion:respAppVersion];
	}
}

@end
